home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / pascal / tptc17tc.zip / FINDCHRS.PAS < prev    next >
Pascal/Delphi Source File  |  1988-03-25  |  1KB  |  44 lines

  1.  
  2. (*
  3.  * Example of sets of characters
  4.  *
  5.  *)
  6.  
  7. program Find_All_Lower_Case_Characters;
  8.  
  9. const 
  10.     String_Size = 30;
  11.  
  12. type 
  13.     Low_Set = set of 'a'..'z';
  14.  
  15. var 
  16.     Data_Set    : Low_Set;
  17.     Storage     : string[String_Size];
  18.     Index       : 1..String_Size;
  19.     Print_Group : string[26];
  20.  
  21. begin  (* main program *)
  22.    Data_Set := [];
  23.    Print_Group := '';
  24.    Storage := 'This is a set test.';
  25.  
  26.    for Index := 1 to Length(Storage) do begin
  27.       if Storage[Index] in ['a'..'z'] then begin
  28.          if Storage[Index] in Data_Set then
  29.             Writeln(Index:4,'   ',Storage[Index],
  30.                          ' is already in the set')
  31.          else begin
  32.             Data_Set := Data_Set + [Storage[Index]];
  33.             Print_Group := Print_Group + Storage[Index];
  34.             Writeln(Index:4,'   ',Storage[Index],
  35.                          ' added to group, complete group = ',
  36.                          Print_Group);
  37.          end;
  38.       end
  39.       else
  40.          Writeln(Index:4,'   ',Storage[Index],
  41.                        ' is not a lower case letter');
  42.    end;
  43. end.  (* of main program *)
  44.